import axiosInstance from '@/api/axiosInstance'
interface progressiveRuleListParams {
  category: string
  staff_type: number
  page: number
  page_size: number
  // 其他查询条件...
}

// 获取累进规则列表
export const getProgressiveRuleList = async (params?: progressiveRuleListParams) => {
  return axiosInstance.get('/admin/progressive-rule', { params })
}

// 获取累进规则详情
export const getProgressiveRuleDetail = async (id: number) => {
  return axiosInstance.get(`/admin/progressive-rule/${id}`)
}
// 创建累进规则
export const createProgressiveRule = async (data: any) => {
  return axiosInstance.post('/admin/progressive-rule', data)
}

// 更新累进规则
export const updateProgressiveRule = async (id: number, data: any) => {
  return axiosInstance.put(`/admin/progressive-rule/${id}`, data)
}

// 删除累进规则
export const deleteProgressiveRule = async (id: number) => {
  return axiosInstance.delete(`/admin/progressive-rule/${id}`)
}

//创建累进项目
export const createRuleItem = async (id: number, data: any) => {
  return axiosInstance.post(`/admin/progressive-rule/${id}/item`, data)
}

//更新累进项目
export const updateRuleItem = async (id: number, levelId: number, data: any) => {
  return axiosInstance.put(`/admin/progressive-rule/${id}/item/${levelId}`, data)
}

//删除累进项目
export const deleteRuleItem = async (id: number, levelId: number) => {
  return axiosInstance.delete(`/admin/progressive-rule/${id}/item/${levelId}`)
}
